package servlet;

import dao.ProductDAO;
import entity.Product;
import org.bson.types.ObjectId;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "ProductMes",value = "/product/mes")
public class ProductMesServlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id=req.getParameter("id");
        ObjectId oid=new ObjectId(id);
        ProductDAO productDao=new ProductDAO();
        Product pro=productDao.findById(oid);
        req.setAttribute("pro",pro);
        req.getRequestDispatcher("/product/Edit.jsp").forward(req,resp);

    }

}